<!-- 免费课程 -->
<template>
	<div class="page_content">
		<div class="top_tab df ac">
			<img src="@/assets/images/jingx.png" alt=""> 免费课程
		</div>
		<div class="df ffrw" v-if="list.length > 0">
			<xy-course-item v-for="item in list" :item="item" :key="item.id"></xy-course-item>
		</div>
		<xy-empty style="--empty-width:200px;--empty-tb:0" v-else v-loading="loading"></xy-empty>
	</div>
</template>

<script setup lang="ts">
import api from '@/api/api';
//组件命名-----
defineOptions({ name: "free-item-index" })
const list = ref<any>([])
const loading = ref(false)
/**
 * 获取首页内容
 *
 * @returns Promise<void> 异步函数，无返回值
 */
const GetindexContent = async () => {
	loading.value = true
	const res = await api.GetindexContent_API()
	if (res.code == 0) {
		list.value = res.data.recommendedCourseVos
	}
	loading.value = false
}

onMounted(() => {
	GetindexContent()
})
</script>

<style lang="scss" scoped>
.top_tab {
	padding: 30px 0;
	font-size: 24px;

	img {
		width: 26px;
		height: 24px;
		margin-right: 10px;
	}
}
</style>
